<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>tango.math.IEEE</title>

<link rel="stylesheet" type="text/css" href="css/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="css/ie56hack.css"><![endif]-->
<script language="JavaScript" src="js/util.js" type="text/javascript"></script>
<script language="JavaScript" src="js/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="js/explorer.js" type="text/javascript"></script>
<script>
function anchorFromTitle(title, path, ext) {
  var url = path + title + "." + ext;
  document.write("<a href='" + url + "'>" + title + "</a>");
  }
</script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("tango.math.IEEE");</script>
        <table class="content">
                <tr><td id="docbody"><h1><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791">tango.math.IEEE</a></h1>
                
<font color="black">Low-level Mathematical Functions which take advantage of the IEEE754 ABI.</font><br><br>
<b>License:</b><br>
BSD style: see <a href="http://www.dsource.org/projects/tango/wiki/LibraryLicense">license.txt</a>, Digital Mars.<br><br>
<b>Authors:</b><br>
Don Clugston, Walter Bright, Sean Kelly<br><br>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>struct <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L239">IeeeFlags</a></span>
<script>explorer.outline.addDecl('IeeeFlags');</script>(T); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">IEEE exception status flags</font><br><br>
<font color="black">These flags indicate that an exceptional floating-point condition has occured.
 They indicate that a NaN or an infinity has been generated, that a result
 is inexact, or that a signalling NaN has been encountered.
 The return values of the properties should be treated as booleans, although
 each is returned as an int, for speed.<br><br> </font><br><br>
<b>Example:</b><br><pre class="d_code">

    <span class="k">real</span> <span class="i">a</span>=<span class="n">3.5</span>;
    <span class="lc">// Set all the flags to zero</span>
    <span class="i">resetIeeeFlags</span>();
    <span class="k">assert</span>(!<span class="i">ieeeFlags</span>.<span class="i">divByZero</span>);
    <span class="lc">// Perform a division by zero.</span>
    <span class="i">a</span>/=<span class="n">0.0L</span>;
    <span class="k">assert</span>(<span class="i">a</span>==<span class="k">real</span>.<span class="i">infinity</span>);
    <span class="k">assert</span>(<span class="i">ieeeFlags</span>.<span class="i">divByZero</span>);
    <span class="lc">// Create a NaN</span>
    <span class="i">a</span>*=<span class="n">0.0L</span>;
    <span class="k">assert</span>(<span class="i">ieeeFlags</span>.<span class="i">invalid</span>);
    <span class="k">assert</span>(<span class="i">isNaN</span>(<span class="i">a</span>));

    <span class="lc">// Check that calling func() has no effect on the</span>
    <span class="lc">// status flags.</span>
    <span class="i">IeeeFlags</span> <span class="i">f</span> = <span class="i">ieeeFlags</span>;
    <span class="i">func</span>();
    <span class="k">assert</span>(<span class="i">ieeeFlags</span> == <span class="i">f</span>);

 
</pre><br><br>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L335">inexact</a></span>
<script>explorer.outline.addDecl('inexact');</script>(); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">The result cannot be represented exactly, so rounding occured.
 &#40;example: x = sin&#40;0.1&#41;; }</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L337">underflow</a></span>
<script>explorer.outline.addDecl('underflow');</script>(); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">A zero was generated by underflow &#40;example: x = real.min*real.epsilon/2;&#41;</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L339">overflow</a></span>
<script>explorer.outline.addDecl('overflow');</script>(); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">An infinity was generated by overflow &#40;example: x = real.max*2;&#41;</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L341">divByZero</a></span>
<script>explorer.outline.addDecl('divByZero');</script>(); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">An infinity was generated by division by zero &#40;example: x = 3/0.0; &#41;</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L343">invalid</a></span>
<script>explorer.outline.addDecl('invalid');</script>(); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">A machine NaN was generated. &#40;example: x = real.infinity * 0.0; &#41;</font><br><br></dd></dl></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>IeeeFlags <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L347">ieeeFlags</a></span>
<script>explorer.outline.addDecl('ieeeFlags');</script>(); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return a snapshot of the current state of the floating-point status flags.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L350">resetIeeeFlags</a></span>
<script>explorer.outline.addDecl('resetIeeeFlags');</script>(); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Set all of the floating-point status flags to false.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>enum <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L355">RoundingMode</a></span>
<script>explorer.outline.addDecl('RoundingMode');</script>; [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">IEEE rounding modes.
 The default mode is ROUNDTONEAREST.
 </font><br><br>
</dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>RoundingMode <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L373">setIeeeRounding</a></span>
<script>explorer.outline.addDecl('setIeeeRounding');</script>(RoundingMode <span class="funcparam">roundingmode</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Change the rounding mode used for all floating-point operations.</font><br><br>
<font color="black">Returns the old rounding mode.<br><br> When changing the rounding mode, it is almost always necessary to restore it
 at the end of the function. Typical usage:
<pre class="d_code">

    <span class="k">auto</span> <span class="i">oldrounding</span> = <span class="i">setIeeeRounding</span>(<span class="i">RoundingMode</span>.<span class="i">ROUNDDOWN</span>);
    <span class="k">scope</span> (<span class="i">exit</span>) <span class="i">setIeeeRounding</span>(<span class="i">oldrounding</span>);

</pre>
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>RoundingMode <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L395">getIeeeRounding</a></span>
<script>explorer.outline.addDecl('getIeeeRounding');</script>(); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Get the IEEE rounding mode which is in use.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>PrecisionControl <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L447">reduceRealPrecision</a></span>
<script>explorer.outline.addDecl('reduceRealPrecision');</script>(PrecisionControl <span class="funcparam">prec</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Set the number of bits of precision used by 'real'.</font><br><br>
<b>Returns:</b><br>
the old precision.
 This is not supported on all platforms.<br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L482">frexp</a></span>
<script>explorer.outline.addDecl('frexp');</script>(real <span class="funcparam">value</span>, out int <span class="funcparam">exp</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Separate floating point value into significand and exponent.</font><br><br>
<b>Returns:</b><br>
Calculate and return <i>x</i> and exp such that
  value =<i>x</i>*2<sup>exp</sup> and
  .5 &lt;= |<i>x</i>| &lt; 1.0<br>
  <i>x</i> has same sign as value.<br><br>  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> value          <th> returns        <th> exp
  <tr> <td> &plusmn;0.0    <td> &plusmn;0.0    <td> 0
  <tr> <td> +&infin;       <td> +&infin;       <td> int.max
  <tr> <td> -&infin;       <td> -&infin;       <td> int.min
  <tr> <td> &plusmn;<font color="red">NAN</font> <td> &plusmn;<font color="red">NAN</font> <td> int.min
  </table><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L637">ldexp</a></span>
<script>explorer.outline.addDecl('ldexp');</script>(real <span class="funcparam">n</span>, int <span class="funcparam">exp</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Compute n * 2<sup>exp</sup>
 </font><br><br>
<b>References:</b><br>frexp<br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L672">ilogb</a></span>
<script>explorer.outline.addDecl('ilogb');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Extracts the exponent of x as a signed integral value.</font><br><br>
<font color="black">If x is not a special value, the result is the same as
 <tt>cast&#40;int&#41;logb&#40;x&#41;</tt>.<br><br> </font><br><br>
<b>Remarks:</b><br>This function is consistent with IEEE754R, but it
 differs from the C function of the same name
 in the return value of infinity. &#40;in C, ilogb&#40;real.infinity&#41;== int.max&#41;.
 Note that the special return values may all be equal.<br><br>  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> x               <th>ilogb(x)           <th>invalid?
  <tr> <td> 0               <td> FP_ILOGB0         <th> yes
  <tr> <td> &plusmn;&infin; <td> FP_ILOGBINFINITY  <th> yes
  <tr> <td> <font color="red">NAN</font>          <td> FP_ILOGBNAN       <th> yes
  </table><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L754">logb</a></span>
<script>explorer.outline.addDecl('logb');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Extracts the exponent of x as a signed integral value.</font><br><br>
<font color="black">If x is subnormal, it is treated as if it were normalized.
 For a positive, finite x:<br><br> <pre class="d_code">

 <span class="n">1</span> &lt;= $(<span class="i">I</span> <span class="i">x</span>) * <span class="i">FLT_RADIX</span>$(<span class="i">SUP</span> -<span class="i">logb</span>(<span class="i">x</span>)) &lt; <span class="i">FLT_RADIX</span>
 
</pre><br><br>  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> x               <th> logb(x)  <th> Divide by 0?
  <tr> <td> &plusmn;&infin; <td> +&infin; <td> no
  <tr> <td> &plusmn;0.0     <td> -&infin; <td> yes
  </table>
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L791">scalbn</a></span>
<script>explorer.outline.addDecl('scalbn');</script>(real <span class="funcparam">x</span>, int <span class="funcparam">n</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Efficiently calculates x * 2<sup>n</sup>.</font><br><br>
<font color="black">scalbn handles underflow and overflow in
 the same fashion as the basic arithmetic operators.<br><br>  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> x                <th> scalb(x)
  <tr> <td> &plusmn;&infin; <td> &plusmn;&infin;
  <tr> <td> &plusmn;0.0      <td> &plusmn;0.0
  </table>
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L825">fdim</a></span>
<script>explorer.outline.addDecl('fdim');</script>(real <span class="funcparam">x</span>, real <span class="funcparam">y</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Returns the positive difference between x and y.</font><br><br>
<font color="black">If either of x or y is <font color="red">NAN</font>, it will be returned.
 </font><br><br>
<b>Returns:</b><br>
<table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr><th>Arguments</th> <th>fdim(x, y)</th></tr>
  <tr><td>x &gt; y</td> <td>x - y</td></tr>
  <tr><td>x &lt;= y</td> <td>+0.0</td></tr>
 </table><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L845">fabs</a></span>
<script>explorer.outline.addDecl('fabs');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Returns |x|</font><br><br>
<font color="black"><table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
  <tr> <th> x               <th> fabs(x)
  <tr> <td> &plusmn;0.0     <td> +0.0
  <tr> <td> &plusmn;&infin; <td> +&infin;
  </table>
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L870">fma</a></span>
<script>explorer.outline.addDecl('fma');</script>(float <span class="funcparam">x</span>, float <span class="funcparam">y</span>, float <span class="funcparam">z</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Returns &#40;x * y&#41; + z, rounding only once according to the
 current rounding mode.</font><br><br>
<font color="red">BUGS:</font><br>
Not currently implemented - rounds twice.<br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>creal <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L882">expi</a></span>
<script>explorer.outline.addDecl('expi');</script>(real <span class="funcparam">y</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Calculate cos&#40;y&#41; + i sin&#40;y&#41;.</font><br><br>
<font color="black">On x86 CPUs, this is a very efficient operation;
 almost twice as fast as calculating sin&#40;y&#41; and cos&#40;y&#41;
 seperately, and is the preferred method when both are required.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L910">isNaN</a></span>
<script>explorer.outline.addDecl('isNaN');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Returns !=0 if e is a NaN.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L951">isNormal</a></span>
<script>explorer.outline.addDecl('isNormal');</script>(X)(X <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Returns !=0 if x is normalized.</font><br><br>
<font color="black">&#40;Need one for each format because subnormal
  floats might be converted to normal reals&#41;
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L993">isIdentical</a></span>
<script>explorer.outline.addDecl('isIdentical');</script>(real <span class="funcparam">x</span>, real <span class="funcparam">y</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1011">isIdentical</a></span>
<script>explorer.outline.addDecl('isIdentical');</script>(ireal <span class="funcparam">x</span>, ireal <span class="funcparam">y</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1016">isIdentical</a></span>
<script>explorer.outline.addDecl('isIdentical');</script>(creal <span class="funcparam">x</span>, creal <span class="funcparam">y</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Is the binary representation of x identical to y?</font><br><br>
<font color="black">Same as ==, except that positive and negative zero are not identical,
 and two <font color="red">NAN</font>s are identical if they have the same 'payload'.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1044">isSubnormal</a></span>
<script>explorer.outline.addDecl('isSubnormal');</script>(float <span class="funcparam">f</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1062">isSubnormal</a></span>
<script>explorer.outline.addDecl('isSubnormal');</script>(double <span class="funcparam">d</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1080">isSubnormal</a></span>
<script>explorer.outline.addDecl('isSubnormal');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Is number subnormal? &#40;Also called "denormal".&#41;
 Subnormals have a 0 exponent and a 0 most significant significand bit,
 but are non-zero.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1114">isZero</a></span>
<script>explorer.outline.addDecl('isZero');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return !=0 if x is &plusmn;0.</font><br><br>
<font color="black">Does not affect any floating-point flags
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1143">isInfinity</a></span>
<script>explorer.outline.addDecl('isInfinity');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return !=0 if e is &plusmn;&infin;.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1193">nextUp</a></span>
<script>explorer.outline.addDecl('nextUp');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>double <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1263">nextDoubleUp</a></span>
<script>explorer.outline.addDecl('nextDoubleUp');</script>(double <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>float <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1285">nextFloatUp</a></span>
<script>explorer.outline.addDecl('nextFloatUp');</script>(float <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Calculate the next largest floating point value after x.</font><br><br>
<font color="black">Return the least number greater than x that is representable as a real;
 thus, it gives the next point on the IEEE number line.
 This function is included in the forthcoming IEEE 754R standard.<br><br>  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
    <tr><th>x</th> <th>nextup(x)   </th></tr>
    <tr><td>-&infin;</td> <td>-real.max   </td></tr>
    <tr><td>&plusmn;0.0</td> <td>real.min*real.epsilon </td></tr>
    <tr><td>real.max</td> <td>real.infinity </td></tr>
    <tr><td>real.infinity</td> <td>real.infinity </td></tr>
    <tr><td><font color="red">NAN</font></td> <td><font color="red">NAN</font>        </td></tr>
 </table><br><br> nextDoubleUp and nextFloatUp are the corresponding functions for
 the IEEE double and IEEE float number lines.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>X <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1370">splitSignificand</a></span>
<script>explorer.outline.addDecl('splitSignificand');</script>(X)(inout X <span class="funcparam">x</span>); [package]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Reduces the magnitude of x, so the bits in the lower half of its significand
 are all zero. Returns the amount which needs to be added to x to restore its
 initial value; this amount will also have zeros in all bits in the lower half
 of its significand.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1423">nextDown</a></span>
<script>explorer.outline.addDecl('nextDown');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>double <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1429">nextDoubleDown</a></span>
<script>explorer.outline.addDecl('nextDoubleDown');</script>(double <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>float <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1435">nextFloatDown</a></span>
<script>explorer.outline.addDecl('nextFloatDown');</script>(float <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Calculate the next smallest floating point value before x.</font><br><br>
<font color="black">Return the greatest number less than x that is representable as a real;
 thus, it gives the previous point on the IEEE number line.
 </font><br><br>
<b>Note:</b><br>This function is included in the forthcoming IEEE 754R standard.<br><br> Special values:
 real.infinity   real.max
 real.min*real.epsilon 0.0
 0.0             -real.min*real.epsilon
 -0.0            -real.min*real.epsilon
 -real.max        -real.infinity
 -real.infinity    -real.infinity
 NAN              NAN<br><br> nextDoubleDown and nextFloatDown are the corresponding functions for
 the IEEE double and IEEE float number lines.<br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1463">nextafter</a></span>
<script>explorer.outline.addDecl('nextafter');</script>(real <span class="funcparam">x</span>, real <span class="funcparam">y</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Calculates the next representable value after x in the direction of y.</font><br><br>
<font color="black">If y &gt; x, the result will be the next largest floating-point value;
 if y &lt; x, the result will be the next smallest value.
 If x == y, the result is y.<br><br> </font><br><br>
<b>Remarks:</b><br>This function is not generally very useful; it's almost always better to use
 the faster functions nextUp&#40;&#41; or nextDown&#40;&#41; instead.<br><br> IEEE 754 requirements not implemented:
 The FE_INEXACT and FE_OVERFLOW exceptions will be raised if x is finite and
 the function result is infinite. The FE_INEXACT and FE_UNDERFLOW
 exceptions will be raised if the function value is subnormal, and x is
 not equal to y.<br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1487">feqrel</a></span>
<script>explorer.outline.addDecl('feqrel');</script>(X)(X <span class="funcparam">x</span>, X <span class="funcparam">y</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">To what precision is x equal to y?</font><br><br>
<b>Returns:</b><br>
the number of significand bits which are equal in x and y.
 eg, 0x1.F8p+60 and 0x1.F1p+60 are equal to 5 bits of precision.<br><br>  <table border=1 cellpadding=4 cellspacing=0>
      <caption>Special Values</caption>
      
    <tr><th>x</th> <th>y</th> <th>feqrel(x, y)  </th></tr>
    <tr><td>x</td> <td>x</td> <td>real.mant_dig </td></tr>
    <tr><td>x</td> <td>&gt;= 2*x</td> <td>0 </td></tr>
    <tr><td>x</td> <td>&lt;= x/2</td> <td>0 </td></tr>
    <tr><td><font color="red">NAN</font></td> <td>any</td> <td>0 </td></tr>
    <tr><td>any</td> <td><font color="red">NAN</font></td> <td>0 </td></tr>
  </table><br><br>
<b>Remarks:</b><br>This is a very fast operation, suitable for use in speed-critical code.<br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>int <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1600">signbit</a></span>
<script>explorer.outline.addDecl('signbit');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return 1 if sign bit of e is set, 0 if not.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1622">copysign</a></span>
<script>explorer.outline.addDecl('copysign');</script>(real <span class="funcparam">to</span>, real <span class="funcparam">from</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return a value composed of to with from's sign bit.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>T <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1670">ieeeMean</a></span>
<script>explorer.outline.addDecl('ieeeMean');</script>(T)(T <span class="funcparam">x</span>, T <span class="funcparam">y</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return the value that lies halfway between x and y on the IEEE number line.</font><br><br>
<font color="black">Formally, the result is the arithmetic mean of the binary significands of x
 and y, multiplied by the geometric mean of the binary exponents of x and y.
 x and y must have the same sign, and must not be NaN.
 </font><br><br>
<b>Note:</b><br>this function is useful for ensuring O&#40;log n&#41; behaviour in algorithms
 involving a 'binary chop'.<br><br> Special cases:
 If x and y are within a factor of 2, &#40;ie, feqrel&#40;x, y&#41; &gt; 0&#41;, the return value
 is the arithmetic mean &#40;x + y&#41; / 2.
 If x and y are even powers of 2, the return value is the geometric mean,
   ieeeMean&#40;x, y&#41; = sqrt&#40;x * y&#41;.<br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>real <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1785">NaN</a></span>
<script>explorer.outline.addDecl('NaN');</script>(ulong <span class="funcparam">payload</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Create a <font color="red">NAN</font>, storing an integer inside the payload.</font><br><br>
<font color="black">For 80-bit or 128-bit reals, the largest possible payload is 0x3FFF_FFFF_FFFF_FFFF.
 For doubles, it is 0x3_FFFF_FFFF_FFFF.
 For floats, it is 0x3F_FFFF.
 </font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>ulong <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/math/IEEE.d?rev=3791#L1845">getNaNPayload</a></span>
<script>explorer.outline.addDecl('getNaNPayload');</script>(real <span class="funcparam">x</span>); [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Extract an integral payload from a <font color="red">NAN</font>.</font><br><br>
<b>Returns:</b><br>
the integer payload as a ulong.<br><br> For 80-bit or 128-bit reals, the largest possible payload is 0x3FFF_FFFF_FFFF_FFFF.
 For doubles, it is 0x3_FFFF_FFFF_FFFF.
 For floats, it is 0x3F_FFFF.<br><br></dd></dl></td></tr>
                <tr><td id="docfooter">
                        Portions Copyright (C) 2001-2005 Digital Mars. :: page rendered by CandyDoc. Generated by <a href="http://code.google.com/p/dil">dil</a> on Sat Aug  2 16:08:34 2008.
                </td></tr>
        </table>
</div>
<script></script>
</body></html>